/*
	The directives starting with # below ensures that this file is read by the compiler only once
	even if it is #included several times. It is call an "include guard"
*/
#ifndef ORDER_H_
#define ORDER_H_

//other types
#include "Chrono.h"					
#include <string>
#include <sstream>
#include <iomanip>
using namespace std;
using namespace Chrono;

struct Order {
public:
	//data

	// constructors
	Order () {}
	Order(int oid, int sid, int tid, Date od, Time ot):
	order_id(oid), server_id(sid), table_id(tid), order_date(od), order_time(ot) {}
   // utility functions
	//[THORIQ-B.2]
	string header() const {
		ostringstream oss;
		oss << left << setw(10) << "Order ID"
			<< left << setw(10) << "Server ID"
			<< left << setw(10) << "Table ID"
			<< left << setw(16) << "Date"
			<< "Time";
		return oss.str();
	}

	string display() const {	
		ostringstream oss, date, time;
		date << order_date;
		time << order_time;

		oss << left << setw(13) << order_id 
			<< left << setw(10) << server_id 
			<< left << setw(10) << table_id 
			<< left << setw(16) << date.str() 
			<< time.str();
		return oss.str();
	}
	int get_table_id() const {return table_id;}	//B.2.a
	int get_order_id() const {return order_id;}	//B.2.a
	
	//Get functions
	int getServerId() //return server_id
	{return server_id;}
	
	//accessor funcs for Date/time by Travis for D1
	int getYear()
	{return order_date.Date::year();}
	
	int getMonth()
	{return order_date.Date::month();}
	
	int getDay()
	{return order_date.Date::day();}
	
	//for Time
	int getHour()
	{return order_time.Time::get_hour();}
		
	int getMinute()
	{return order_time.Time::get_minute();}
private:
   //constants

   // private data
	int order_id;
	int server_id;
	int table_id;
	Date order_date;
	Time order_time;
};


#endif //ORDER_H_
